#pragma once
#include <unistd.h>
#include "TCP_Server.hpp"
#include "TCP_Calculator.hpp"

// #include "Daemon.hpp"

static void Usage(const std::string &proc)
{
    std::cout << "\nUsage: " << proc << " port\n" << std::endl; 
}

int main(int argc,char**argv)
{
    if(argc != 2)
    {
        Usage(argv[0]);
        exit(0);
    }
    uint16_t port = std::stoi(argv[1]);
    ServerCal server;
    //bind是绑定函数，将参数和函数绑定  std::placeholders::_1占位符，
    TCPserver*tcp_pointer=new TCPserver(port,std::bind(&ServerCal::Calculator,&server,std::placeholders::_1));
    tcp_pointer->InitTCPServer();
    tcp_pointer->Start();
    return 0;
}